#include "SessionValidator.h"

void CSessionValidator::AddToken( uint32 nUsdId, uint32 nToken )
{
    if (m_Tokens.find(nUsdId) == m_Tokens.end())
        m_Tokens[nUsdId] = nToken;
}

bool CSessionValidator::IsValid( uint32 nUsdId, uint32 nToken )
{
    TTokenContainer::iterator i = m_Tokens.find(nUsdId);
    if (i != m_Tokens.end())
    {
        bool result = (i->second == nToken);
        m_Tokens.erase(i);
        return result;
    }
    return false;
}
